package JavaEE初阶;

import java.util.Scanner;

public class Demo01 {
    private static int isQuit = 0;

    public static void main(String[] args) {
        Thread t1 = new Thread(() ->{
           while(isQuit == 0){

           }
            System.out.println("t1退出");

        });
        t1.start();

        Thread t2 = new Thread(() ->{
            System.out.println("请输入isQuit");
            Scanner scanner = new Scanner(System.in);
            //如果用户输入的值不为0，则此时就会使得t1线程结束
            isQuit = scanner.nextInt();
        });
        t2.start();
    }
}
